Optimal. Leaf size=92 \[ -\frac{\tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right ) \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )}{c^2 \sqrt{b^2-4 a c}}+\frac{(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2}+\frac{h x}{c} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.156163, antiderivative size = 92, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 5, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.217, Rules used = {1657, 634, 618, 206, 628} \[ -\frac{\tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right ) \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )}{c^2 \sqrt{b^2-4 a c}}+\frac{(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2}+\frac{h x}{c} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 1657
Rule 634
Rule 618
Rule 206
Rule 628
Rubi steps
\begin{align*} \int \frac{f+g x+h x^2}{a+b x+c x^2} \, dx &=\int \left (\frac{h}{c}+\frac{c f-a h+(c g-b h) x}{c \left (a+b x+c x^2\right )}\right ) \, dx\\ &=\frac{h x}{c}+\frac{\int \frac{c f-a h+(c g-b h) x}{a+b x+c x^2} \, dx}{c}\\ &=\frac{h x}{c}+\frac{(c g-b h) \int \frac{b+2 c x}{a+b x+c x^2} \, dx}{2 c^2}+\frac{\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) \int \frac{1}{a+b x+c x^2} \, dx}{2 c^2}\\ &=\frac{h x}{c}+\frac{(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2}-\frac{\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) \operatorname{Subst}\left (\int \frac{1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{c^2}\\ &=\frac{h x}{c}-\frac{\left (2 c^2 f-b c g+b^2 h-2 a c h\right ) \tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right )}{c^2 \sqrt{b^2-4 a c}}+\frac{(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2}\\ \end{align*}
Mathematica [A] time = 0.0710634, size = 95, normalized size = 1.03 \[ \frac{\tan ^{-1}\left (\frac{b+2 c x}{\sqrt{4 a c-b^2}}\right ) \left (-2 a c h+b^2 h-b c g+2 c^2 f\right )}{c^2 \sqrt{4 a c-b^2}}+\frac{(c g-b h) \log \left (a+b x+c x^2\right )}{2 c^2}+\frac{h x}{c} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.175, size = 196, normalized size = 2.1 \begin{align*}{\frac{hx}{c}}-{\frac{\ln \left ( c{x}^{2}+bx+a \right ) bh}{2\,{c}^{2}}}+{\frac{\ln \left ( c{x}^{2}+bx+a \right ) g}{2\,c}}-2\,{\frac{ah}{c\sqrt{4\,ac-{b}^{2}}}\arctan \left ({\frac{2\,cx+b}{\sqrt{4\,ac-{b}^{2}}}} \right ) }+2\,{\frac{f}{\sqrt{4\,ac-{b}^{2}}}\arctan \left ({\frac{2\,cx+b}{\sqrt{4\,ac-{b}^{2}}}} \right ) }+{\frac{{b}^{2}h}{{c}^{2}}\arctan \left ({(2\,cx+b){\frac{1}{\sqrt{4\,ac-{b}^{2}}}}} \right ){\frac{1}{\sqrt{4\,ac-{b}^{2}}}}}-{\frac{bg}{c}\arctan \left ({(2\,cx+b){\frac{1}{\sqrt{4\,ac-{b}^{2}}}}} \right ){\frac{1}{\sqrt{4\,ac-{b}^{2}}}}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)] time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.62718, size = 670, normalized size = 7.28 \begin{align*} \left [\frac{2 \,{\left (b^{2} c - 4 \, a c^{2}\right )} h x -{\left (2 \, c^{2} f - b c g +{\left (b^{2} - 2 \, a c\right )} h\right )} \sqrt{b^{2} - 4 \, a c} \log \left (\frac{2 \, c^{2} x^{2} + 2 \, b c x + b^{2} - 2 \, a c + \sqrt{b^{2} - 4 \, a c}{\left (2 \, c x + b\right )}}{c x^{2} + b x + a}\right ) +{\left ({\left (b^{2} c - 4 \, a c^{2}\right )} g -{\left (b^{3} - 4 \, a b c\right )} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \,{\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}, \frac{2 \,{\left (b^{2} c - 4 \, a c^{2}\right )} h x - 2 \,{\left (2 \, c^{2} f - b c g +{\left (b^{2} - 2 \, a c\right )} h\right )} \sqrt{-b^{2} + 4 \, a c} \arctan \left (-\frac{\sqrt{-b^{2} + 4 \, a c}{\left (2 \, c x + b\right )}}{b^{2} - 4 \, a c}\right ) +{\left ({\left (b^{2} c - 4 \, a c^{2}\right )} g -{\left (b^{3} - 4 \, a b c\right )} h\right )} \log \left (c x^{2} + b x + a\right )}{2 \,{\left (b^{2} c^{2} - 4 \, a c^{3}\right )}}\right ] \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] time = 2.03855, size = 488, normalized size = 5.3 \begin{align*} \left (- \frac{\sqrt{- 4 a c + b^{2}} \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \left (4 a c - b^{2}\right )} - \frac{b h - c g}{2 c^{2}}\right ) \log{\left (x + \frac{- a b h - 4 a c^{2} \left (- \frac{\sqrt{- 4 a c + b^{2}} \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \left (4 a c - b^{2}\right )} - \frac{b h - c g}{2 c^{2}}\right ) + 2 a c g + b^{2} c \left (- \frac{\sqrt{- 4 a c + b^{2}} \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \left (4 a c - b^{2}\right )} - \frac{b h - c g}{2 c^{2}}\right ) - b c f}{2 a c h - b^{2} h + b c g - 2 c^{2} f} \right )} + \left (\frac{\sqrt{- 4 a c + b^{2}} \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \left (4 a c - b^{2}\right )} - \frac{b h - c g}{2 c^{2}}\right ) \log{\left (x + \frac{- a b h - 4 a c^{2} \left (\frac{\sqrt{- 4 a c + b^{2}} \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \left (4 a c - b^{2}\right )} - \frac{b h - c g}{2 c^{2}}\right ) + 2 a c g + b^{2} c \left (\frac{\sqrt{- 4 a c + b^{2}} \left (2 a c h - b^{2} h + b c g - 2 c^{2} f\right )}{2 c^{2} \left (4 a c - b^{2}\right )} - \frac{b h - c g}{2 c^{2}}\right ) - b c f}{2 a c h - b^{2} h + b c g - 2 c^{2} f} \right )} + \frac{h x}{c} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.13261, size = 120, normalized size = 1.3 \begin{align*} \frac{h x}{c} + \frac{{\left (c g - b h\right )} \log \left (c x^{2} + b x + a\right )}{2 \, c^{2}} + \frac{{\left (2 \, c^{2} f - b c g + b^{2} h - 2 \, a c h\right )} \arctan \left (\frac{2 \, c x + b}{\sqrt{-b^{2} + 4 \, a c}}\right )}{\sqrt{-b^{2} + 4 \, a c} c^{2}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]